// components/cart-list/cart-list.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    carts: {
      type: Array,
      value: []
    },
    isCart: {
      type: Boolean,
      value: true
    },
    isCollect: {
      type: Boolean,
      value: false
    }
  },

  /**
   * 组件的初始数据
   */
  data: {

  },

  /**
   * 组件的方法列表
   */
  methods: {
    handelSelect(e) {
      let index = e.currentTarget.dataset.index;
      this.triggerEvent('select', {
        index
      })
    },
    handleNumEdit(e) {
      let { operation, index } = e.currentTarget.dataset;

      this.triggerEvent('num-edit', {
        operation, index
      })
    }
  }
})
